<?php

namespace app\controller;

use app\BaseController;
use think\facade\Db;

class Login extends BaseController
{
    public function index()
    {
        if ($this->request->isPost()) {
            $post = $this->request->post();

            $list = Db::table('boc_user')->where(['UserName' => $post['UserName'], 'PassWord' => md5($post['PassWord']), 'status' => 1])->find();
            if ($list) {
                return json(['code' => 200, 'msg' => '登录成功', 'data' => $list]);
            } else {
                return json(['code' => 400, 'msg' => '账号或密码错误']);
            }
        }
    }
}
